package dao.impl;

import dao.IOrderDao;
import model.Order;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;
import java.util.Map;

@Repository
public class OrderDao implements IOrderDao {
    @Autowired
    private SqlSession sqlSession;

    @Override
    public List<Order> query(Order order) {
        return sqlSession.selectList("dao.IOrderDao.query", order);
    }

    @Override
    public int totalCount(Order order) {
        return sqlSession.selectOne("dao.IOrderDao.totalCount", order);
    }

    @Override
    public List<Order> listByOrderNo(Order order) {
        return  sqlSession.selectList("dao.IOrderDao.listByOrderNo", order);
    }

    @Override
    public void jobForOrder() {
        sqlSession.update("dao.IOrderDao.jobForOrder");
    }

    @Override
    public int orderStatus(Order order) {
        return  sqlSession.update("dao.IOrderDao.orderStatus", order);
    }

    @Override
    public int orderGoods(Order order) {
        return  sqlSession.insert("dao.IOrderDao.orderGoods", order);
    }

    @Override
    public List<Order> listOrderByUId(Integer UId) {
        return sqlSession.selectList("dao.IOrderDao.listOrderByUId", UId);
    }

    @Override
    public int updateOrderStatus(Order order ) {
        return  sqlSession.update("dao.IOrderDao.updateOrderStatus", order);
    }

    @Override
    public void shipment(String orderNo) {
         sqlSession.update("dao.IOrderDao.shipment", orderNo);
    }

    @Override
    public void refundMoney(Order order) {
         sqlSession.update("dao.IOrderDao.refundMoney", order);
    }

    @Override
    public void refund(Order order) {
         sqlSession.update("dao.IOrderDao.refund", order);
    }




}
